package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/5190a1db6f4f4ddb92fd9c365c944584?tpId=37&tqId=21249&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 10:33
 **/
public class StrOrderMain {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while (in.hasNext()) {
            String str = in.nextLine();
            strOrderd(str);
        }

    }

    private static void strOrderd(String str) {
        StringBuilder sb = new StringBuilder();
        int dis = 'A' - 'a';
        // 先对所有字符串排序
        for (int i = 0; i < 26; i++) {
            char m = (char) ('a' + i);
            for (int j = 0; j < str.length(); j++) {
                char c = str.charAt(j);
                if (m == c || c == (m + dis)) {
                    sb.append(c);
                }
            }
        }

        // 然后插入非字符串
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
                continue;
            } else {
                sb.insert(i, c);
            }
        }

        System.out.println(sb.toString());
    }
}
